package com.cty.config;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.servlet.config.annotation.*;

/*配置：
* 1.是一个配置类
* 2.HandlerMapper,HandlerAdaptor
* 3.json
* 4.静态资源转换器
* 5.视图解析器
* 6.拦截器
* 7.异常处理...
* */
@Configuration
@ComponentScan("com.cty.controller")
@EnableWebMvc //json、HandlerMapper和HandlerAdapt
public class MvcConfig implements WebMvcConfigurer {

    //视图解析器
    @Override
    public void configureViewResolvers(ViewResolverRegistry registry) {
        registry.jsp("/WEB-INF/views",".jsp");
    }

    //静态资源
    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }

    //拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

    }
}
